<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts: printf/n2a.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">ESP8266ILI9341DisplayProject</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_012ec66c173e5cefcc171f0e37014eef.html">printf</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">n2a.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="n2a_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#ifdef PRINTF_TEST</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;stdarg.h&gt;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="mathio_8h.html">mathio.h</a>&quot;</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keywordtype">void</span> test10(<span class="keywordtype">long</span> <span class="keywordtype">long</span> max)</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;{</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> val;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> s;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;testing mul10str() function: (%lld) values\n&quot;</span>, max);</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordflow">for</span>(val=0;val&lt;max;++val)</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    {</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        s = val;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        <a class="code" href="mathio_8c.html#aee46e805a6a25105661e6486a419fdc3">mul10str</a>((<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *) &amp;s, <span class="keyword">sizeof</span>(s));</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">if</span>(s != (val * 10))</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;%lld * 10 = %lld, != %lld\n&quot;</span>, val, (val * 10), s);</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    }</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;Done %lld tests\n\n&quot;</span>, val);</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;}</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keywordtype">int</span> <a class="code" href="send_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;{</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">int</span> len;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keywordtype">int</span> size;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keywordtype">int</span> sign_ch;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keywordtype">char</span> line[1024];</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="keywordtype">char</span> numresult[1024];</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> val;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    __int128_t val2;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;sizeof(long) = %d\n&quot;</span>, (<span class="keywordtype">int</span>) <span class="keyword">sizeof</span>(<span class="keywordtype">long</span>));</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;sizeof(long long) = %d\n&quot;</span>, (<span class="keywordtype">int</span>) <span class="keyword">sizeof</span>(<span class="keywordtype">long</span> <span class="keywordtype">long</span>));</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;sizeof(val) = %d\n&quot;</span>, (<span class="keywordtype">int</span>) <span class="keyword">sizeof</span>(val));</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;sizeof(__uint128_t) = %d\n&quot;</span>, (<span class="keywordtype">int</span>) <span class="keyword">sizeof</span>(__uint128_t));</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;sizeof( intmax_t ) == %d\n&quot;</span>, (<span class="keywordtype">int</span>) <span class="keyword">sizeof</span>( intmax_t ));</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    test10(1000000LL);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keywordflow">while</span>(1) {</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;Enter a number or ENTER to quit:&quot;</span>);</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <a class="code" href="posix_8c.html#a3759827e157badd49d076bd157f508d9">fgets</a>(line, 1020,<a class="code" href="posix_8h.html#aaca70138f0cb63ddb026921afc635179">stdin</a>);</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        len = <a class="code" href="stringsup_8c.html#a895ea3a2f9901e4c962806cc15271339">strlen</a>(line);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        <span class="keywordflow">while</span>(len)</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        {</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;            --len;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            <span class="keywordflow">if</span>(line[len] &lt; <span class="charliteral">&#39; &#39;</span>)</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                line[len] = 0;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        }</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        <span class="keywordflow">if</span>(!*line)</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            <span class="keywordflow">break</span>;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        sign_ch = 0;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        val2 = strto128(line, <a class="code" href="cpu_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, 10);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        <span class="keywordflow">if</span>(val2 &lt; (__int128_t) 0)</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        {</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            sign_ch = <span class="charliteral">&#39;-&#39;</span>; </div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            val2 = -val2;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        }</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        size = <a class="code" href="mathio_8h.html#aa95ef42dcc41a90255c084e0e1a9bcde">bin2num</a>(numresult, 1022, 1, 10, (<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *) &amp;val2, <span class="keyword">sizeof</span>(val2), sign_ch);</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="comment">//dump(numresult,size);</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;numresult[%s]\n&quot;</span>,numresult);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    }</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;}</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="stringsup_8c_html_a895ea3a2f9901e4c962806cc15271339"><div class="ttname"><a href="stringsup_8c.html#a895ea3a2f9901e4c962806cc15271339">strlen</a></div><div class="ttdeci">MEMSPACE size_t WEAK_ATR strlen(const char *str)</div><div class="ttdoc">String Length. </div><div class="ttdef"><b>Definition:</b> <a href="stringsup_8c_source.html#l00146">stringsup.c:146</a></div></div>
<div class="ttc" id="mathio_8c_html_aee46e805a6a25105661e6486a419fdc3"><div class="ttname"><a href="mathio_8c.html#aee46e805a6a25105661e6486a419fdc3">mul10str</a></div><div class="ttdeci">MEMSPACE int mul10str(uint8_t *str, int size)</div><div class="ttdoc">Fast multiply number of any size by 10. </div><div class="ttdef"><b>Definition:</b> <a href="mathio_8c_source.html#l00108">mathio.c:108</a></div></div>
<div class="ttc" id="posix_8c_html_a3759827e157badd49d076bd157f508d9"><div class="ttname"><a href="posix_8c.html#a3759827e157badd49d076bd157f508d9">fgets</a></div><div class="ttdeci">MEMSPACE char * fgets(char *str, int size, FILE *stream)</div><div class="ttdoc">get a string from stdin See fdevopen() sets stream-&gt;put get for TTY devices </div><div class="ttdef"><b>Definition:</b> <a href="posix_8c_source.html#l00420">posix.c:420</a></div></div>
<div class="ttc" id="mathio_8h_html_aa95ef42dcc41a90255c084e0e1a9bcde"><div class="ttname"><a href="mathio_8h.html#aa95ef42dcc41a90255c084e0e1a9bcde">bin2num</a></div><div class="ttdeci">MEMSPACE int bin2num(uint8_t *str, int strmax, int nummin, int base, uint8_t *nump, int numsize, int sign_ch)</div><div class="ttdoc">Convert an unsigned number (numsize bytes in size) to ASCII in specified base Notes: No limit except ...</div><div class="ttdef"><b>Definition:</b> <a href="printf_8c_source.html#l00139">printf.c:139</a></div></div>
<div class="ttc" id="cpu_8h_html_a070d2ce7b6bb7e5c05602aa8c308d0c4"><div class="ttname"><a href="cpu_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></div><div class="ttdeci">#define NULL</div><div class="ttdef"><b>Definition:</b> <a href="cpu_8h_source.html#l00055">cpu.h:55</a></div></div>
<div class="ttc" id="send_8c_html_a0ddf1224851353fc92bfbff6f499fa97"><div class="ttname"><a href="send_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a></div><div class="ttdeci">int main(int argc, char *argv[])</div><div class="ttdef"><b>Definition:</b> <a href="send_8c_source.html#l00148">send.c:148</a></div></div>
<div class="ttc" id="mathio_8h_html"><div class="ttname"><a href="mathio_8h.html">mathio.h</a></div><div class="ttdoc">Math IO functions, and verious conversion code with floating point support. </div></div>
<div class="ttc" id="posix_8h_html_aaca70138f0cb63ddb026921afc635179"><div class="ttname"><a href="posix_8h.html#aaca70138f0cb63ddb026921afc635179">stdin</a></div><div class="ttdeci">#define stdin</div><div class="ttdoc">define stdin, stdout and stderr </div><div class="ttdef"><b>Definition:</b> <a href="posix_8h_source.html#l00269">posix.h:269</a></div></div>
<div class="ttc" id="mathio_8h_html_ad6078f8da2d30ecaef99e0c2d250c0c8"><div class="ttname"><a href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a></div><div class="ttdeci">MEMSPACE int printf(const char *format,...)</div></div>
<div class="ttc" id="send_8c_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> <a href="send_8c_source.html#l00017">send.c:17</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 31 2018 21:22:16 for ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
